package variationsSearch;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;

public class Relevancy {
	public static void main(String []args) throws IOException{
		HashMap<String, Integer> ht = new LinkedHashMap<String,Integer>();
		PrintStream ps = new PrintStream("J:\\BC3_IMT_Training\\Relevant Terms in Legands.txt");
		FileReader fr= new FileReader("J:\\BC3_IMT_Training\\Legands Found.txt");
		BufferedReader fbr = new BufferedReader(fr);
		String str = fbr.readLine();
		while(str!=null){
			String s[]=str.split("\t");
			String key = s[0]+"\t"+s[2];
			if(ht.containsKey(key)==false){
				ht.put(key, 1);
				
			}
			else{
				int c = ht.get(key);
				c++;
				ht.put(key, c);
			}
			str=fbr.readLine();
		}
		Iterator<String> itr = ht.keySet().iterator();
		while(itr.hasNext()){
			String next = itr.next();
			ps.println(next+"\t"+ht.get(next));
		}
		
	}
	
}
